<!-- created:2022/12/19 20:59 By AdinZ -->
<template>
    <div class="index dashboard">

        <el-row :gutter="20">
            <el-col :span="8" class="item" v-for="key in Object.keys(list)" :key="key">
                <el-card v-if="list[key] &&list[key].length>0">
                    <div class="flex flex-center text-center" :data-type="key">
                        <div class="flex1" v-for="(item,index) in list[key]" :key="index" :class="{'item-0':index==0}">
                            <div class="number">
                                {{ item.value || 0 }}
                            </div>
                            <div class="label">
                                {{ item.label }}
                            </div>
                        </div>
                    </div>
                </el-card>
            </el-col>
        </el-row>


    </div>
</template>

<script>
export default {
    name: "index",
    data() {
        return {
            list: {
                'shop': [],
                'user': [],
                'activity': [],
                'order': [],
                'recharge_user': [],
                'recharge_shop': [],
                'withdraw_user': [],
                'withdraw_shop': [],
                'group': [],
                'spike': [],
                'lottery': [],
            }
        }
    },
    mounted() {
        Object.keys(this.list).forEach(key => {
            this.getDashboard(key)
        })
    },
    methods: {

        getDashboard(key) {
            this.$api.get(`/api/platform/system/dashboard/${key}`).then(res => {
                this.list[key] = res.data;
            })
        }

    }
}
</script>

<style scoped lang="scss">
.dashboard {
    .item {
        margin-bottom: 20px;

        .number {
            font-size: 40px;
            font-weight: bold;
        }

        .item-0 {
            border-right: 1px dotted #cccccc;
        }

    }
}
</style>